package com.gulimall.search.controller;

import com.gulimall.common.core.domain.Result;
import com.gulimall.common.domain.es.SkuEsModel;
import com.gulimall.search.service.ProductUpService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("/search/save")
public class ElasticSaveController {
    @Resource
    private ProductUpService productUpService;

    /**
     * 上架商品
     */
    @PostMapping("/product/up")
    public Result productUp(@RequestBody List<SkuEsModel> skuEsModels) throws IOException {
        log.info("准备上架的商品信息为：{}",skuEsModels);
        return productUpService.productUp(skuEsModels);
    }
}
